<template>
  <div class="lca-container">
    <div class="header">
      <h1>产品生命周期评估(LCA)流程</h1>
    </div>
    
    <div class="process-sections">
      <LCASection 
        title="01 目标与范围定义"
        :active="activeSection === 1"
        @click="setActiveSection(1)"
      >
        <div class="section-content">
          <InfoCard title="LCA评估基本信息">
            <div class="info-grid">
              <div class="info-item">
                <label>系统边界：</label>
                <span>保留到这个门</span>
              </div>
              <div class="info-item">
                <label>数据收集日期：</label>
                <span>2024-04-01 至 2024-04-30</span>
              </div>
              <div class="info-item">
                <label>基准Population：</label>
                <span>2000.00个(piece)</span>
              </div>
            </div>
          </InfoCard>
          
          <InfoCard title="产品基本信息">
            <div class="info-grid">
              <div class="info-item">
                <label>功能单位：</label>
                <span>10个パ眼袋</span>
              </div>
              <div class="info-item">
                <label>产品净重/单位：</label>
                <span>10.00Kg</span>
              </div>
            </div>
          </InfoCard>
        </div>
      </LCASection>
      
      <LCASection 
        title="02 生命周期清单"
        :active="activeSection === 2"
        @click="setActiveSection(2)"
      >
        <div class="section-content">
          <DataTable :data="inventoryData" />
        </div>
      </LCASection>
      
      <LCASection 
        title="03 结果分析"
        :active="activeSection === 3"
        @click="setActiveSection(3)"
      >
        <div class="section-content">
          <div class="analysis-grid">
            <InfoCard title="生物质燃料">
              <div class="value">0.0kg/cm</div>
            </InfoCard>
            <InfoCard title="排放总量">
              <div class="value">0.0kg/cm</div>
            </InfoCard>
            <InfoCard title="化石燃料">
              <div class="value">0kg/cm</div>
            </InfoCard>
            <InfoCard title="土地使用变化">
              <div class="value">0kg/cm³</div>
            </InfoCard>
          </div>
        </div>
      </LCASection>
      
      <LCASection 
        title="04 报告结论"
        :active="activeSection === 4"
        @click="setActiveSection(4)"
      >
        <div class="section-content">
          <InfoCard title="研究报告">
            <div class="report-info">
              <div class="info-item">
                <label>公司名称：</label>
                <span>Demo</span>
              </div>
              <div class="info-item">
                <label>产品名称：</label>
                <span>大理石</span>
              </div>
              <div class="info-item">
                <label>产品型号：</label>
                <span>TY·2024001</span>
              </div>
            </div>
          </InfoCard>
        </div>
      </LCASection>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import LCASection from './LCASection.vue';
import InfoCard from './InfoCard.vue';
import DataTable from './DataTable.vue';

const activeSection = ref(1);

const setActiveSection = (section) => {
  activeSection.value = section;
};

const inventoryData = ref([
  { process: '材料获取', productionOutput: '0.0kg', productStorage: 'kgCO', transport: '0.0kg/cm³' },
  { process: '生产过程', productionOutput: '0.0kg/cm³', productTransport: 'kgCO', volatileResult: '0.0kg' },
  { process: '产品配送', total: '0.0kg', totalEmissions: '0.0kg' },
  { process: '排放总量', totalEmissions: '0.0kg', empty: '' }
]);
</script>

<style scoped>
.lca-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  background-color: white;
}

.header {
  text-align: center;
  margin-bottom: 32px;
}

.header h1 {
  color: #2e7d32;
  font-size: 28px;
}

.process-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section-content {
  padding: 20px;
  background-color: #f8f8f8;
  border-radius: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.info-item {
  display: flex;
  margin-bottom: 12px;
}

.info-item label {
  font-weight: bold;
  min-width: 120px;
  color: #555;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.value {
  font-size: 24px;
  color: #2e7d32;
  text-align: center;
  padding: 16px 0;
}

.report-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
</style>